/* Generic class information */

#ifndef MC_CLASS_INFO_HPP
#define MC_CLASS_INFO_HPP

#include <memchart/types.hpp>

namespace memchart
{
	/* Information about one class member */
	class member_info
	{
		public:

			/* Name of this member */
			string name;

			/* Compiler-generated type name of this member */
			string type;

			/* The constructor and destructor */

			member_info (const string & name, const string & type)
				: name(name),
				type(type)
			{ }

			virtual ~member_info ()
			{ }

			/* Read and write values using supplied pointer to object */

			virtual string read (uintptr_t obj) const = 0;
			
			virtual bool is_writable () const = 0;
			virtual void write (uintptr_t obj, const string & val) const = 0;

			virtual bool is_pointer () const = 0;
			virtual uintptr_t read_pointer (uintptr_t obj) const = 0;
	};

	/* A container of member_info objects */
	class class_info
	{
		public:

			/* Class name */
			const string name;

			class_info (const string & name)
				: name(name)
			{ }

			virtual ~class_info ()
			{ }

			/* Return count of member_info objects */
			virtual size_t count () const = 0;
			virtual size_t non_pointer_count () const = 0;

			/* Access a member_info object */
			virtual const member_info & operator [] (size_t i) const = 0;
	};
}

#endif /* MC_CLASS_INFO_HPP */
